package com.zdyl.fileReplaceTool.Controler;

import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import java.io.File;
import java.net.URL;

/**
 * @version V1.0
 * @Title:
 * @Package
 * @Description:
 * @author: runoob
 * @date:
 */
public class Log4jControl {
    //初始化log4j配置
    public Log4jControl(){
        URL url = this.getClass().getResource("/resources/log4j.properties");
        PropertyConfigurator.configure(url);
        String path = new File("").getAbsolutePath();
        FileAppender appender = (FileAppender) Logger.getRootLogger().getAppender("file");
        appender.setFile(path + File.separator + "fileReplaceTool.log");
    }
}
